home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 December: Technology Seed / ATS Dec. '97.toast / QuickDraw™ 3D 1.5.3 SDK for Mac / Development / Interfaces / QD3D.h next >
Encoding:
C/C++ Source or Header  |  1997-10-31  |  40.6 KB  |  1,243 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3D.h                                                     **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     System include file.                                     **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **                                                                              **
  10.  **     Copyright (C) 1992-1997 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                              **
  12.  **                                                                              **
  13.  *****************************************************************************/
  14. #ifndef QD3D_h
  15. #define QD3D_h
  16.  
  17. #include <stdio.h>
  18.  
  19. /*
  20.  *
  21.  *  A B O U T   Q D 3 D _ O B S O L E T E:
  22.  *
  23.  *
  24.  *  NOTE:the flag QD3D_OBSOLETE is used to mark API calls that are being
  25.  *       deprecated.  This means we intend to remove them in the future.
  26.  *         If you define the name QD3D_OBSOLETE then the "old" API calls will
  27.  *         still work.  We recommend switching to the new versions of these
  28.  *         calls for maximum compatibility.  If you want to enable the flag
  29.  *         then you should set its value to 1 (true).  For example if you use
  30.  *         a prefix file then you could place the following line in it:
  31.  *
  32.  *            #define QD3D_OBSOLETE    1
  33.  *
  34.  *         or if your compiler accepts the -d option, on your compile line add
  35.  *
  36.  *            -d QD3D_OBSOLETE=1
  37.  *
  38.  *         to your compile line.
  39.  */ 
  40.  
  41. /******************************************************************************
  42.  **                                                                             **
  43.  **                                Porting Control                                 **
  44.  **                                                                             **
  45.  *****************************************************************************/
  46.  
  47. /*
  48.  *  NOTE:  To compile on a Unix workstation (assumes X11 window system):
  49.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  50.  *                2. Add "-DOS_UNIX=1"
  51.  *                3. Add "-DWINDOW_SYSTEM_X11=1"
  52.  */
  53.  
  54. #if defined(_WIN32) || defined(_WINDOWS)
  55.     #define OS_MACINTOSH                0
  56.     #define OS_WIN32                    1
  57.     #define OS_UNIX                        0
  58.     #define OS_NEXT                        0
  59.  
  60.     #define WINDOW_SYSTEM_MACINTOSH        0
  61.     #define WINDOW_SYSTEM_WIN32            1
  62.     #define WINDOW_SYSTEM_X11            0
  63.     #define WINDOW_SYSTEM_NEXT            0
  64.  
  65. #elif defined(NeXT) && NeXT
  66.     #define OS_MACINTOSH                0
  67.     #define OS_WIN32                    0
  68.     #define OS_UNIX                        0
  69.     #define OS_NEXT                        1
  70.     
  71.     #define WINDOW_SYSTEM_MACINTOSH        0
  72.     #define WINDOW_SYSTEM_WIN32            0
  73.     #define WINDOW_SYSTEM_X11            0
  74.     #define WINDOW_SYSTEM_NEXT            1
  75.  
  76. #elif !defined(OS_MACINTOSH)
  77.     #define OS_MACINTOSH                1
  78.     #define OS_WIN32                    0
  79.     #define OS_UNIX                        0
  80.     #define OS_NEXT                        0
  81.  
  82.     #define WINDOW_SYSTEM_MACINTOSH        1
  83.     #define WINDOW_SYSTEM_WIN32            0
  84.     #define WINDOW_SYSTEM_X11            0
  85.     #define WINDOW_SYSTEM_NEXT            0
  86.  
  87.     #if defined(__MRC__) || defined(__SC__) || defined(__MWERKS__)
  88.          #define PRAGMA_ONCE                1
  89.     #else
  90.          #define PRAGMA_ONCE                0
  91.     #endif  /* defined(__MRC__) || defined(__SC__) || defined(__MWERKS__)  */
  92.  
  93.     /*
  94.      *  Set required compiler options (if possible):
  95.      *   1. enums must always be ints in QD3D and in applications;
  96.      *      this consistency is required to prevent misinterpretation
  97.      *      of an app's enum values by an API; it is also required for
  98.      *      compliance with ANSI
  99.      *   2. alignment of longs, floats, and pointers in structures
  100.      *      is on long boundaries for PowerPC
  101.      */
  102.     #if defined(__xlc__) || defined(__XLC121__)
  103.         #pragma options enum=int
  104.         #pragma options align=power
  105.     #elif defined(__MWERKS__)
  106.         #pragma enumsalwaysint on
  107.         #pragma options align=native
  108.     #elif defined(__MRC__) || defined(__SC__)
  109.         #if __option(pack_enums)
  110.             #define PRAGMA_ENUM_RESET_QD3D 1
  111.         #endif
  112.         #pragma options(!pack_enums)
  113.         #pragma options align=power
  114.     #endif
  115.     
  116.     enum {
  117.         gestaltQD3D                = 'qd3d',
  118.         gestaltQD3DVersion        = 'q3v ',
  119.         gestaltQD3DNotPresent    = 0,
  120.         gestaltQD3DAvailable    = 1
  121.     };
  122.     
  123. #endif  /*  OS_MACINTOSH  */
  124.  
  125. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  126.     #pragma once
  127. #endif  /*  PRAGMA_ONCE  */ 
  128.  
  129.  
  130. #ifdef __cplusplus
  131. extern "C" {
  132. #endif    /* __cplusplus */
  133.  
  134.  
  135. /******************************************************************************
  136.  **                                                                             **
  137.  **                                Export Control                                 **
  138.  **                                                                             **
  139.  *****************************************************************************/
  140.  
  141. #if defined(_MSC_VER)    /* Microsoft Visual C */
  142.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  143.         #define QD3D_EXPORT __declspec( dllexport )     
  144.         #define QD3D_CALL    
  145.         #define QD3D_CALLBACK    
  146.     #else
  147.         #define QD3D_EXPORT
  148.         #define QD3D_CALL    __cdecl
  149.         #define QD3D_CALLBACK    __cdecl    
  150.     #endif /* WIN32_EXPORTING */
  151. #else
  152.     #define QD3D_EXPORT
  153.     #define QD3D_CALL    
  154.     #define QD3D_CALLBACK    
  155. #endif  /*  _MSC_VER  */
  156.  
  157.  
  158. /******************************************************************************
  159.  **                                                                             **
  160.  **                                NULL definition                                 **
  161.  **                                                                             **
  162.  *****************************************************************************/
  163.  
  164. #ifndef NULL
  165.     #error NULL is undefined.
  166. #endif /* NULL */
  167.  
  168.  
  169. /******************************************************************************
  170.  **                                                                             **
  171.  **                                    Objects                                     **
  172.  **                                                                             **
  173.  *****************************************************************************/
  174. /*
  175.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  176.  * deletion, duplication, and i/o methods.
  177.  */
  178. typedef long                    TQ3ObjectType;
  179.  
  180. typedef struct TQ3ObjectPrivate    *TQ3Object;
  181.  
  182. /*
  183.  * There are four subclasses of OBJECT:
  184.  *    an ELEMENT, which is data that is placed in a SET
  185.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  186.  *    VIEWs, which maintain state information for an image
  187.  *    a PICK, which used to query a VIEW
  188.  */
  189. typedef TQ3Object                TQ3ElementObject;
  190. typedef TQ3Object                TQ3SharedObject;
  191. typedef TQ3Object                TQ3ViewObject;
  192. typedef TQ3Object                TQ3PickObject;
  193.  
  194. /*
  195.  * There are several types of SharedObjects:
  196.  *    RENDERERs, which paint to a drawContext
  197.  *    DRAWCONTEXTs, which are an interface to a device 
  198.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  199.  *    FILEs, which maintain state information for a metafile
  200.  *    SHAPEs, which affect the state of the View
  201.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  202.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  203.  *    TRACKERs, which represent a position and orientation in the user interface
  204.  *  STRINGs, which are abstractions of text string data.
  205.  *    STORAGE, which is an abstraction for stream-based data storage (files, 
  206.  *        memory)
  207.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  208.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  209.  */
  210. typedef TQ3SharedObject            TQ3RendererObject;
  211. typedef TQ3SharedObject            TQ3DrawContextObject;
  212. typedef TQ3SharedObject            TQ3SetObject;
  213. typedef TQ3SharedObject            TQ3FileObject;
  214. typedef TQ3SharedObject            TQ3ShapeObject;
  215. typedef TQ3SharedObject            TQ3ShapePartObject;
  216. typedef TQ3SharedObject            TQ3ControllerStateObject;
  217. typedef TQ3SharedObject            TQ3TrackerObject;
  218. typedef TQ3SharedObject            TQ3StringObject;
  219. typedef TQ3SharedObject            TQ3StorageObject;
  220. typedef TQ3SharedObject            TQ3TextureObject;
  221. typedef TQ3SharedObject            TQ3ViewHintsObject;
  222.  
  223.  
  224. /*
  225.  * There is one types of SET:
  226.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  227.  */
  228. typedef TQ3SetObject                TQ3AttributeSet;
  229.  
  230. /*
  231.  * There are many types of SHAPEs:
  232.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  233.  *    CAMERAs, which affects the location and orientation of the RENDERER in 
  234.  *        space
  235.  *    GROUPs, which may contain any number of SHARED OBJECTS
  236.  *    GEOMETRYs, which are representations of three-dimensional data
  237.  *    SHADERs, which affect how colors are drawn on a geometry
  238.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  239.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  240.  *    REFERENCEs, which are references to objects in FILEs
  241.  *  UNKNOWN, which hold unknown objects read from a metafile.
  242.  */
  243. typedef TQ3ShapeObject            TQ3GroupObject;
  244. typedef TQ3ShapeObject            TQ3GeometryObject;
  245. typedef TQ3ShapeObject            TQ3ShaderObject;
  246. typedef TQ3ShapeObject            TQ3StyleObject;
  247. typedef TQ3ShapeObject            TQ3TransformObject;
  248. typedef TQ3ShapeObject            TQ3LightObject;
  249. typedef TQ3ShapeObject            TQ3CameraObject;
  250. typedef TQ3ShapeObject            TQ3UnknownObject;
  251. typedef TQ3ShapeObject            TQ3ReferenceObject;
  252.  
  253. /*
  254.  * For now, there is only one type of SHAPEPARTs:
  255.  *    MESHPARTs, which describe some part of a mesh
  256.  */
  257. typedef TQ3ShapePartObject        TQ3MeshPartObject;
  258.  
  259. /*
  260.  * There are three types of MESHPARTs:
  261.  *    MESHFACEPARTs, which describe a face of a mesh
  262.  *    MESHEDGEPARTs, which describe a edge of a mesh
  263.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  264.  */
  265. typedef TQ3MeshPartObject        TQ3MeshFacePartObject;
  266. typedef TQ3MeshPartObject        TQ3MeshEdgePartObject;
  267. typedef TQ3MeshPartObject        TQ3MeshVertexPartObject;
  268.  
  269. /*
  270.  * A DISPLAY Group can be drawn to a view
  271.  */
  272. typedef TQ3GroupObject            TQ3DisplayGroupObject;
  273.  
  274. /*
  275.  * There are many types of SHADERs:
  276.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  277.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  278.  */
  279. typedef TQ3ShaderObject            TQ3SurfaceShaderObject;
  280. typedef TQ3ShaderObject            TQ3IlluminationShaderObject;
  281.  
  282. /*
  283.  * A handle to an object in a group
  284.  */
  285. typedef struct TQ3GroupPositionPrivate    *TQ3GroupPosition;
  286.  
  287. /* 
  288.  * TQ3ObjectClassNameString is used for the class name of an object
  289.  */
  290. enum {
  291.     kQ3StringMaximumLength = 1024
  292. };
  293.  
  294. typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  295.  
  296.  
  297. /******************************************************************************
  298.  **                                                                             **
  299.  **                            Client/Server Things                             **
  300.  **                                                                             **
  301.  *****************************************************************************/
  302.  
  303. typedef void *TQ3ControllerRef;
  304.  
  305.  
  306. /******************************************************************************
  307.  **                                                                             **
  308.  **                            Flags and Switches                                 **
  309.  **                                                                             **
  310.  *****************************************************************************/
  311.  
  312. typedef enum TQ3Boolean {
  313.     kQ3False,
  314.     kQ3True
  315. } TQ3Boolean;
  316.  
  317. typedef enum TQ3Switch {
  318.     kQ3Off,
  319.     kQ3On
  320. } TQ3Switch;
  321.  
  322. typedef enum TQ3Status {
  323.     kQ3Failure,
  324.     kQ3Success
  325. } TQ3Status;
  326.  
  327. typedef enum TQ3Axis {
  328.     kQ3AxisX,
  329.     kQ3AxisY,
  330.     kQ3AxisZ
  331. } TQ3Axis;
  332.  
  333. typedef enum TQ3PixelType {
  334.     kQ3PixelTypeRGB32        = 0,    /* Alpha:8 (ignored), R:8, G:8, B:8    */
  335.     kQ3PixelTypeARGB32        = 1,    /* Alpha:8, R:8, G:8, B:8             */
  336.     kQ3PixelTypeRGB16        = 2,    /* Alpha:1 (ignored), R:5, G:5, B:5    */
  337.     kQ3PixelTypeARGB16        = 3        /* Alpha:1, R:5, G:5, B:5             */
  338. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  339.     ,
  340.     kQ3PixelTypeRGB16_565    = 4,    /* 16 bits/pixel, R:5, G:6, B:5        */
  341.     kQ3PixelTypeRGB24        = 5        /* 24 bits/pixel, R:8, G:8, B:8        */
  342. #endif /* WINDOW_SYSTEM_WIN32 */
  343. } TQ3PixelType;
  344.  
  345. typedef enum TQ3Endian{
  346.     kQ3EndianBig,
  347.     kQ3EndianLittle
  348. } TQ3Endian;
  349.  
  350. typedef enum TQ3EndCapMasks {
  351.     kQ3EndCapNone            = 0,
  352.     kQ3EndCapMaskTop        = 1 << 0,
  353.     kQ3EndCapMaskBottom        = 1 << 1,
  354.     kQ3EndCapMaskInterior    = 1 << 2
  355. } TQ3EndCapMasks;
  356.  
  357. typedef unsigned long TQ3EndCap;
  358.  
  359. enum {
  360.     kQ3ArrayIndexNULL = ~0
  361. };
  362.  
  363.  
  364. /******************************************************************************
  365.  **                                                                             **
  366.  **                        Point and Vector Definitions                         **
  367.  **                                                                             **
  368.  *****************************************************************************/
  369.  
  370. typedef struct TQ3Vector2D {
  371.     float        x;
  372.     float        y;
  373. } TQ3Vector2D;
  374.  
  375. typedef struct TQ3Vector3D {
  376.     float         x;
  377.     float        y;
  378.     float        z;
  379. } TQ3Vector3D;
  380.  
  381. typedef struct TQ3Point2D {
  382.     float        x;
  383.     float        y;
  384. } TQ3Point2D;
  385.  
  386. typedef struct TQ3Point3D {
  387.     float         x;
  388.     float        y;
  389.     float        z;
  390. } TQ3Point3D;
  391.  
  392. typedef struct TQ3RationalPoint4D {
  393.     float         x;
  394.     float        y;
  395.     float        z;
  396.     float        w;
  397. } TQ3RationalPoint4D;
  398.  
  399. typedef struct TQ3RationalPoint3D {
  400.     float        x;
  401.     float        y;
  402.     float        w;
  403. } TQ3RationalPoint3D;
  404.  
  405.  
  406. /******************************************************************************
  407.  **                                                                             **
  408.  **                                Quaternion                                     **
  409.  **                                                                             **
  410.  *****************************************************************************/
  411.  
  412. typedef struct TQ3Quaternion {
  413.     float        w;
  414.     float        x;
  415.     float        y;
  416.     float        z;
  417. } TQ3Quaternion;
  418.  
  419.  
  420. /******************************************************************************
  421.  **                                                                             **
  422.  **                                Ray Definition                                 **
  423.  **                                                                             **
  424.  *****************************************************************************/
  425.  
  426. typedef struct TQ3Ray3D {
  427.     TQ3Point3D        origin;
  428.     TQ3Vector3D        direction;
  429. } TQ3Ray3D;
  430.  
  431.  
  432. /******************************************************************************
  433.  **                                                                             **
  434.  **                        Parameterization Data Structures                     **
  435.  **                                                                             **
  436.  *****************************************************************************/
  437.  
  438. typedef struct TQ3Param2D {
  439.     float            u;
  440.     float            v;
  441. } TQ3Param2D;
  442.  
  443. typedef struct TQ3Param3D {
  444.     float            u;
  445.     float            v;
  446.     float            w;
  447. } TQ3Param3D;
  448.  
  449. typedef struct TQ3Tangent2D {
  450.     TQ3Vector3D        uTangent;
  451.     TQ3Vector3D        vTangent;
  452. } TQ3Tangent2D;
  453.  
  454. typedef struct TQ3Tangent3D {
  455.     TQ3Vector3D        uTangent;
  456.     TQ3Vector3D        vTangent;
  457.     TQ3Vector3D        wTangent;
  458. } TQ3Tangent3D;
  459.  
  460.  
  461. /******************************************************************************
  462.  **                                                                             **
  463.  **                        Polar and Spherical Coordinates                         **
  464.  **                                                                             **
  465.  *****************************************************************************/
  466.  
  467.  typedef struct TQ3PolarPoint {
  468.      float        r;
  469.      float        theta;
  470.   } TQ3PolarPoint;
  471.  
  472.  typedef struct TQ3SphericalPoint {
  473.      float        rho;
  474.      float        theta;
  475.      float        phi;
  476.  } TQ3SphericalPoint;
  477.  
  478.  
  479. /******************************************************************************
  480.  **                                                                             **
  481.  **                            Color Definition                                 **
  482.  **                                                                             **
  483.  *****************************************************************************/
  484.  
  485. typedef struct TQ3ColorRGB {
  486.     float             r;
  487.     float            g;
  488.     float            b;
  489. } TQ3ColorRGB;
  490.  
  491.  
  492. typedef struct TQ3ColorARGB {
  493.     float             a;
  494.     float             r;
  495.     float            g;
  496.     float            b;
  497. } TQ3ColorARGB;
  498.  
  499.  
  500. /******************************************************************************
  501.  **                                                                             **
  502.  **                                    Vertices                                 **
  503.  **                                                                             **
  504.  *****************************************************************************/
  505.  
  506. typedef struct TQ3Vertex3D {
  507.     TQ3Point3D            point;
  508.     TQ3AttributeSet        attributeSet;
  509. }  TQ3Vertex3D;
  510.  
  511.  
  512. /******************************************************************************
  513.  **                                                                             **
  514.  **                                    Matrices                                 **
  515.  **                                                                             **
  516.  *****************************************************************************/
  517.  
  518. typedef struct TQ3Matrix3x3 {
  519.     float    value[3][3];
  520. } TQ3Matrix3x3;
  521.  
  522. typedef struct TQ3Matrix4x4 {
  523.     float    value[4][4];
  524. } TQ3Matrix4x4;
  525.  
  526.  
  527.  
  528.  
  529. /******************************************************************************
  530.  **                                                                             **
  531.  **                                Bitmap/Pixmap                                 **
  532.  **                                                                             **
  533.  *****************************************************************************/
  534.  
  535. typedef struct TQ3Pixmap {
  536.     void                *image;
  537.     unsigned long        width;
  538.     unsigned long        height;
  539.     unsigned long        rowBytes;
  540.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the         */
  541.                                     /* Interactive Renderer on Mac OS         */
  542.     TQ3PixelType        pixelType;
  543.     TQ3Endian            bitOrder;
  544.     TQ3Endian            byteOrder;
  545. } TQ3Pixmap;
  546.  
  547. typedef struct TQ3StoragePixmap {
  548.     TQ3StorageObject    image;
  549.     unsigned long        width;
  550.     unsigned long        height;
  551.     unsigned long        rowBytes;
  552.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the     */
  553.                                     /* Interactive Renderer on Mac OS        */
  554.     TQ3PixelType        pixelType;
  555.     TQ3Endian            bitOrder;
  556.     TQ3Endian            byteOrder;
  557. } TQ3StoragePixmap;
  558.  
  559. typedef struct TQ3Bitmap {
  560.     unsigned char        *image;
  561.     unsigned long        width;
  562.     unsigned long        height;
  563.     unsigned long        rowBytes;
  564.     TQ3Endian            bitOrder;
  565. } TQ3Bitmap;
  566.  
  567. typedef struct TQ3MipmapImage {        /* An image for use as a texture mipmap  */
  568.     unsigned long        width;        /* Width of mipmap, must be power of 2   */
  569.     unsigned long        height;        /* Height of mipmap, must be power of 2  */
  570.     unsigned long        rowBytes;    /* Rowbytes of mipmap                    */
  571.     unsigned long        offset;        /* Offset from image base to this mipmap */
  572. } TQ3MipmapImage;
  573.  
  574. typedef struct TQ3Mipmap {
  575.     TQ3StorageObject    image;        /* Data containing the texture map and     */
  576.                                     /* if (useMipmapping==kQ3True) the         */
  577.                                     /* mipmap data                             */
  578.     TQ3Boolean            useMipmapping;/* True if mipmapping should be used     */
  579.                                     /* and all mipmaps have been provided   */
  580.     TQ3PixelType        pixelType;
  581.     TQ3Endian            bitOrder;
  582.     TQ3Endian            byteOrder;
  583.     unsigned long        reserved;    /* leave NULL for next version */
  584.     TQ3MipmapImage        mipmaps[32];/* The actual number of mipmaps is         */
  585.                                     /* determined from the size of the         */
  586.                                     /* first mipmap                            */
  587. } TQ3Mipmap;
  588.  
  589.  
  590. /******************************************************************************
  591.  **                                                                             **
  592.  **                        Higher dimension quantities                             **
  593.  **                                                                             **
  594.  *****************************************************************************/
  595.  
  596. typedef struct TQ3Area {
  597.     TQ3Point2D             min;
  598.     TQ3Point2D             max;
  599. } TQ3Area;
  600.  
  601. typedef struct TQ3PlaneEquation {
  602.     TQ3Vector3D            normal;
  603.     float                constant;
  604. } TQ3PlaneEquation;
  605.  
  606. typedef struct TQ3BoundingBox {
  607.     TQ3Point3D             min;
  608.     TQ3Point3D             max;
  609.     TQ3Boolean            isEmpty;
  610. } TQ3BoundingBox;
  611.  
  612. typedef struct TQ3BoundingSphere {
  613.     TQ3Point3D            origin;
  614.     float                radius;
  615.     TQ3Boolean            isEmpty;
  616. } TQ3BoundingSphere;
  617.  
  618. /*
  619.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  620.  *    calls in the View. It's a hint to the system as to how it should 
  621.  *    compute the bbox of a shape:
  622.  *
  623.  *    kQ3ComputeBoundsExact:    
  624.  *        Vertices of shapes are transformed into world space and
  625.  *        the world space bounding box is computed from them.  Slow!
  626.  *    
  627.  *    kQ3ComputeBoundsApproximate: 
  628.  *        A local space bounding box is computed from a shape's
  629.  *        vertices.  This bbox is then transformed into world space,
  630.  *        and its bounding box is taken as the shape's approximate
  631.  *        bbox.  Fast but the bbox is larger than optimal.
  632.  */
  633. typedef enum TQ3ComputeBounds {
  634.     kQ3ComputeBoundsExact,
  635.     kQ3ComputeBoundsApproximate
  636. } TQ3ComputeBounds;
  637.  
  638.  
  639. /******************************************************************************
  640.  **                                                                             **
  641.  **                            Object System Types                                 **
  642.  **                                                                             **
  643.  *****************************************************************************/
  644.  
  645.  
  646.  
  647. typedef struct TQ3ObjectClassPrivate        *TQ3XObjectClass;
  648.  
  649. typedef unsigned long                         TQ3XMethodType;
  650.  
  651. /*
  652.  *  Object methods
  653.  */
  654. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  655.  
  656. /* 
  657.  *  Return true from the metahandler if this 
  658.  *  object can be submitted in a rendering loop 
  659.  */
  660. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    
  661.  
  662. typedef void (QD3D_CALLBACK *TQ3XFunctionPointer)(
  663.     void);
  664.  
  665. typedef TQ3XFunctionPointer (QD3D_CALLBACK *TQ3XMetaHandler)(
  666.     TQ3XMethodType        methodType);
  667.  
  668. /*
  669.  * MetaHandler:
  670.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  671.  *        times to build method tables, and then is thrown away. You are 
  672.  *        guaranteed that your metahandler will never be called again after a 
  673.  *        call that was passed a metahandler returns.
  674.  *
  675.  *        Your metahandler should contain a switch on the methodType passed to it
  676.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  677.  *
  678.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  679.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  680.  *
  681.  *        These types here are prototypes of how your functions should look.
  682.  */
  683. typedef TQ3Status (QD3D_CALLBACK *TQ3XObjectUnregisterMethod)(
  684.     TQ3XObjectClass        objectClass);
  685.     
  686. /*
  687.  * See QD3DIO.h for the IO method types: 
  688.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  689.  */
  690.  
  691.  
  692. /******************************************************************************
  693.  **                                                                             **
  694.  **                                Set Types                                     **
  695.  **                                                                             **
  696.  *****************************************************************************/
  697.  
  698. typedef long                    TQ3ElementType;
  699.  
  700. #define kQ3ElementTypeNone        0
  701. #define kQ3ElementTypeUnknown    32
  702. #define kQ3ElementTypeSet        33
  703.  
  704. /* 
  705.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  706.  *    
  707.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  708.  *        
  709.  *        Note that the object is always referenced when copying around. 
  710.  *        
  711.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  712.  *        group of other "objects" which have been found in the metafile and
  713.  *        have no attachment method to their parent. Be prepared to handle
  714.  *        any or all of these cases if you actually access the set on a shape.
  715.  *
  716.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  717.  *    
  718.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  719.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  720.  *            
  721.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  722.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  723.  *    
  724.  *        Note that the object is always referenced when copying around. 
  725.  *        
  726.  *    See the note below about the Set and Shape changes.
  727.  */
  728.  
  729. /******************************************************************************
  730.  **                                                                             **
  731.  **                            Object System Macros                             **
  732.  **                                                                             **
  733.  *****************************************************************************/
  734.  
  735. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  736.             ((const unsigned long)                     \
  737.             ((const unsigned long) (a) << 24) |     \
  738.             ((const unsigned long) (b) << 16) |        \
  739.             ((const unsigned long) (c) << 8)  |     \
  740.             ((const unsigned long) (d)))
  741.  
  742. #define Q3_OBJECT_TYPE(a,b,c,d) \
  743.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  744.  
  745. #define Q3_METHOD_TYPE(a,b,c,d) \
  746.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  747.  
  748.  
  749.  
  750. /******************************************************************************
  751.  **                                                                             **
  752.  **                                Object Types                                 **
  753.  **                                                                             **
  754.  *****************************************************************************/
  755.  
  756. /*
  757.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  758.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  759.  */
  760. #define kQ3ObjectTypeInvalid                            0L
  761. #define kQ3ObjectTypeView                                Q3_OBJECT_TYPE('v','i','e','w')
  762. #define kQ3ObjectTypeElement                            Q3_OBJECT_TYPE('e','l','m','n')
  763.     #define kQ3ElementTypeAttribute                        Q3_OBJECT_TYPE('e','a','t','t')
  764. #define kQ3ObjectTypePick                                Q3_OBJECT_TYPE('p','i','c','k')
  765.     #define kQ3PickTypeWindowPoint                        Q3_OBJECT_TYPE('p','k','w','p')
  766.     #define kQ3PickTypeWindowRect                        Q3_OBJECT_TYPE('p','k','w','r')
  767. #define kQ3ObjectTypeShared                                Q3_OBJECT_TYPE('s','h','r','d')
  768.     #define kQ3SharedTypeRenderer                        Q3_OBJECT_TYPE('r','d','d','r')
  769.         #define kQ3RendererTypeWireFrame                Q3_OBJECT_TYPE('w','r','f','r')
  770.         #define kQ3RendererTypeGeneric                    Q3_OBJECT_TYPE('g','n','r','r')
  771.         #define kQ3RendererTypeInteractive                Q3_OBJECT_TYPE('c','t','w','n')
  772.     #define kQ3SharedTypeShape                            Q3_OBJECT_TYPE('s','h','a','p')
  773.         #define kQ3ShapeTypeGeometry                    Q3_OBJECT_TYPE('g','m','t','r')
  774.             #define kQ3GeometryTypeBox                    Q3_OBJECT_TYPE('b','o','x',' ')
  775.             #define kQ3GeometryTypeGeneralPolygon        Q3_OBJECT_TYPE('g','p','g','n')
  776.             #define kQ3GeometryTypeLine                    Q3_OBJECT_TYPE('l','i','n','e')
  777.             #define kQ3GeometryTypeMarker                Q3_OBJECT_TYPE('m','r','k','r')
  778.             #define kQ3GeometryTypePixmapMarker            Q3_OBJECT_TYPE('m','r','k','p')
  779.             #define kQ3GeometryTypeMesh                    Q3_OBJECT_TYPE('m','e','s','h')
  780.             #define kQ3GeometryTypeNURBCurve            Q3_OBJECT_TYPE('n','r','b','c')
  781.             #define kQ3GeometryTypeNURBPatch            Q3_OBJECT_TYPE('n','r','b','p')
  782.             #define kQ3GeometryTypePoint                Q3_OBJECT_TYPE('p','n','t',' ')
  783.             #define kQ3GeometryTypePolygon                Q3_OBJECT_TYPE('p','l','y','g')
  784.             #define kQ3GeometryTypePolyLine                Q3_OBJECT_TYPE('p','l','y','l')
  785.             #define kQ3GeometryTypeTriangle                Q3_OBJECT_TYPE('t','r','n','g')
  786.             #define kQ3GeometryTypeTriGrid                Q3_OBJECT_TYPE('t','r','i','g')
  787.             #define kQ3GeometryTypeCone                    Q3_OBJECT_TYPE('c','o','n','e')
  788.             #define kQ3GeometryTypeCylinder                Q3_OBJECT_TYPE('c','y','l','n')
  789.             #define kQ3GeometryTypeDisk                    Q3_OBJECT_TYPE('d','i','s','k')
  790.             #define kQ3GeometryTypeEllipse                Q3_OBJECT_TYPE('e','l','p','s')
  791.             #define kQ3GeometryTypeEllipsoid            Q3_OBJECT_TYPE('e','l','p','d')
  792.             #define kQ3GeometryTypePolyhedron            Q3_OBJECT_TYPE('p','l','h','d')
  793.             #define kQ3GeometryTypeTorus                Q3_OBJECT_TYPE('t','o','r','s')
  794.             #define kQ3GeometryTypeTriMesh                Q3_OBJECT_TYPE('t','m','s','h')
  795.         #define kQ3ShapeTypeShader                        Q3_OBJECT_TYPE('s','h','d','r')
  796.             #define kQ3ShaderTypeSurface                Q3_OBJECT_TYPE('s','u','s','h')
  797.                 #define kQ3SurfaceShaderTypeTexture        Q3_OBJECT_TYPE('t','x','s','u')
  798.             #define kQ3ShaderTypeIllumination            Q3_OBJECT_TYPE('i','l','s','h')
  799.                 #define kQ3IlluminationTypePhong        Q3_OBJECT_TYPE('p','h','i','l')
  800.                 #define kQ3IlluminationTypeLambert        Q3_OBJECT_TYPE('l','m','i','l')
  801.                 #define kQ3IlluminationTypeNULL            Q3_OBJECT_TYPE('n','u','i','l')
  802.         #define kQ3ShapeTypeStyle                        Q3_OBJECT_TYPE('s','t','y','l')
  803.             #define kQ3StyleTypeBackfacing                Q3_OBJECT_TYPE('b','c','k','f')
  804.             #define kQ3StyleTypeInterpolation            Q3_OBJECT_TYPE('i','n','t','p')
  805.             #define kQ3StyleTypeFill                    Q3_OBJECT_TYPE('f','i','s','t')
  806.             #define kQ3StyleTypePickID                    Q3_OBJECT_TYPE('p','k','i','d')
  807.             #define kQ3StyleTypeReceiveShadows            Q3_OBJECT_TYPE('r','c','s','h')
  808.             #define kQ3StyleTypeHighlight                Q3_OBJECT_TYPE('h','i','g','h')
  809.             #define kQ3StyleTypeSubdivision                Q3_OBJECT_TYPE('s','b','d','v')
  810.             #define kQ3StyleTypeOrientation                Q3_OBJECT_TYPE('o','f','d','r')
  811.             #define kQ3StyleTypePickParts                Q3_OBJECT_TYPE('p','k','p','t')
  812.             #define kQ3StyleTypeAntiAlias                Q3_OBJECT_TYPE('a','n','t','i')
  813.         #define kQ3ShapeTypeTransform                    Q3_OBJECT_TYPE('x','f','r','m')
  814.             #define kQ3TransformTypeMatrix                Q3_OBJECT_TYPE('m','t','r','x')
  815.             #define kQ3TransformTypeScale                Q3_OBJECT_TYPE('s','c','a','l')
  816.             #define kQ3TransformTypeTranslate            Q3_OBJECT_TYPE('t','r','n','s')
  817.             #define kQ3TransformTypeRotate                Q3_OBJECT_TYPE('r','o','t','t')
  818.             #define kQ3TransformTypeRotateAboutPoint     Q3_OBJECT_TYPE('r','t','a','p')
  819.             #define kQ3TransformTypeRotateAboutAxis     Q3_OBJECT_TYPE('r','t','a','a')
  820.             #define kQ3TransformTypeQuaternion            Q3_OBJECT_TYPE('q','t','r','n')
  821.             #define kQ3TransformTypeReset                Q3_OBJECT_TYPE('r','s','e','t')
  822.         #define kQ3ShapeTypeLight                        Q3_OBJECT_TYPE('l','g','h','t')
  823.             #define kQ3LightTypeAmbient                    Q3_OBJECT_TYPE('a','m','b','n')
  824.             #define kQ3LightTypeDirectional                Q3_OBJECT_TYPE('d','r','c','t')
  825.             #define kQ3LightTypePoint                    Q3_OBJECT_TYPE('p','n','t','l')
  826.             #define kQ3LightTypeSpot                    Q3_OBJECT_TYPE('s','p','o','t')
  827.         #define kQ3ShapeTypeCamera                        Q3_OBJECT_TYPE('c','m','r','a')
  828.             #define kQ3CameraTypeOrthographic            Q3_OBJECT_TYPE('o','r','t','h')
  829.             #define kQ3CameraTypeViewPlane                Q3_OBJECT_TYPE('v','w','p','l')
  830.             #define kQ3CameraTypeViewAngleAspect        Q3_OBJECT_TYPE('v','a','n','a')
  831.     
  832.         #define kQ3ShapeTypeGroup                        Q3_OBJECT_TYPE('g','r','u','p')
  833.             #define kQ3GroupTypeDisplay                    Q3_OBJECT_TYPE('d','s','p','g')
  834.                 #define kQ3DisplayGroupTypeOrdered        Q3_OBJECT_TYPE('o','r','d','g')
  835.                 #define kQ3DisplayGroupTypeIOProxy        Q3_OBJECT_TYPE('i','o','p','x')
  836.             #define kQ3GroupTypeLight                    Q3_OBJECT_TYPE('l','g','h','g')
  837.             #define kQ3GroupTypeInfo                    Q3_OBJECT_TYPE('i','n','f','o')
  838.         #define kQ3ShapeTypeUnknown                        Q3_OBJECT_TYPE('u','n','k','n')
  839.             #define kQ3UnknownTypeText                    Q3_OBJECT_TYPE('u','k','t','x')
  840.             #define kQ3UnknownTypeBinary                Q3_OBJECT_TYPE('u','k','b','n')
  841.         #define kQ3ShapeTypeReference                    Q3_OBJECT_TYPE('r','f','r','n')
  842.             #define kQ3ReferenceTypeExternal            Q3_OBJECT_TYPE('r','f','e','x')
  843.     #define kQ3SharedTypeSet                            Q3_OBJECT_TYPE('s','e','t',' ')
  844.         #define kQ3SetTypeAttribute                        Q3_OBJECT_TYPE('a','t','t','r')
  845.     #define kQ3SharedTypeDrawContext                    Q3_OBJECT_TYPE('d','c','t','x')
  846.         #define kQ3DrawContextTypePixmap                Q3_OBJECT_TYPE('d','p','x','p')
  847.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  848.         #define kQ3DrawContextTypeMacintosh                Q3_OBJECT_TYPE('d','m','a','c')
  849.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  850.         #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  851.         #define kQ3DrawContextTypeWin32DC                Q3_OBJECT_TYPE('d','w','3','2')
  852.         #define kQ3DrawContextTypeDDSurface                Q3_OBJECT_TYPE('d','d','d','s')
  853.         #endif  /*  WINDOW_SYSTEM_WIN32  */
  854.         #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  855.         #define kQ3DrawContextTypeX11                    Q3_OBJECT_TYPE('d','x','1','1')
  856.         #endif  /*  WINDOW_SYSTEM_X11  */
  857.     #define kQ3SharedTypeTexture                        Q3_OBJECT_TYPE('t','x','t','r')
  858.         #define kQ3TextureTypePixmap                    Q3_OBJECT_TYPE('t','x','p','m')
  859.         #define kQ3TextureTypeMipmap                    Q3_OBJECT_TYPE('t','x','m','m')
  860.     #define kQ3SharedTypeFile                            Q3_OBJECT_TYPE('f','i','l','e')
  861.     #define kQ3SharedTypeStorage                        Q3_OBJECT_TYPE('s','t','r','g')
  862.         #define kQ3StorageTypeMemory                    Q3_OBJECT_TYPE('m','e','m','s')
  863.             #if defined(OS_MACINTOSH) && OS_MACINTOSH
  864.             #define kQ3MemoryStorageTypeHandle            Q3_OBJECT_TYPE('h','n','d','l')
  865.             #endif  /*  OS_MACINTOSH  */
  866.         #define kQ3StorageTypeUnix                        Q3_OBJECT_TYPE('u','x','s','t')
  867.             #define kQ3UnixStorageTypePath                Q3_OBJECT_TYPE('u','n','i','x')
  868.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  869.         #define kQ3StorageTypeMacintosh                    Q3_OBJECT_TYPE('m','a','c','n')
  870.             #define kQ3MacintoshStorageTypeFSSpec        Q3_OBJECT_TYPE('m','a','c','p')                    
  871.         #endif  /*  OS_MACINTOSH  */
  872.         #if defined(OS_WIN32) && OS_WIN32
  873.         #define kQ3StorageTypeWin32                        Q3_OBJECT_TYPE('w','i','s','t')
  874.         #endif  /*  OS_WIN32  */
  875.     #define kQ3SharedTypeString                            Q3_OBJECT_TYPE('s','t','r','n')
  876.         #define kQ3StringTypeCString                    Q3_OBJECT_TYPE('s','t','r','c')
  877.     #define kQ3SharedTypeShapePart                        Q3_OBJECT_TYPE('s','p','r','t')
  878.         #define kQ3ShapePartTypeMeshPart                Q3_OBJECT_TYPE('s','p','m','h')
  879.             #define kQ3MeshPartTypeMeshFacePart            Q3_OBJECT_TYPE('m','f','a','c')
  880.             #define kQ3MeshPartTypeMeshEdgePart            Q3_OBJECT_TYPE('m','e','d','g')
  881.             #define kQ3MeshPartTypeMeshVertexPart        Q3_OBJECT_TYPE('m','v','t','x')
  882.     #define kQ3SharedTypeControllerState                Q3_OBJECT_TYPE('c','t','s','t')
  883.     #define kQ3SharedTypeTracker                        Q3_OBJECT_TYPE('t','r','k','r')
  884.     #define kQ3SharedTypeViewHints                        Q3_OBJECT_TYPE('v','w','h','n')
  885.     #define kQ3SharedTypeEndGroup                        Q3_OBJECT_TYPE('e','n','d','g')
  886.  
  887.  
  888. /******************************************************************************
  889.  **                                                                             **
  890.  **                            QuickDraw 3D System Routines                     **
  891.  **                                                                             **
  892.  *****************************************************************************/
  893.  
  894. QD3D_EXPORT TQ3Status QD3D_CALL Q3Initialize(
  895.     void);
  896.  
  897. QD3D_EXPORT TQ3Status QD3D_CALL Q3Exit(
  898.     void);
  899.  
  900. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3IsInitialized(
  901.     void);
  902.  
  903. QD3D_EXPORT TQ3Status QD3D_CALL Q3GetVersion(
  904.     unsigned long        *majorRevision,
  905.     unsigned long        *minorRevision);
  906.  
  907. /*
  908.  *  Q3GetReleaseVersion returns the release version number,
  909.  *  in the format of the first four bytes of a 'vers' resource
  910.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  911.  */
  912. QD3D_EXPORT TQ3Status QD3D_CALL Q3GetReleaseVersion(
  913.     unsigned long        *releaseRevision);
  914.  
  915.  
  916. /******************************************************************************
  917.  **                                                                             **
  918.  **                            ObjectClass Routines                             **
  919.  **                                                                             **
  920.  *****************************************************************************/
  921.  
  922.  
  923. /* 
  924.  *  New object system calls to query the object system.
  925.  *
  926.  *  These comments to move to the stubs file before final release, they 
  927.  *  are here for documentation for developers using early seeds.
  928.  */
  929.  
  930. /*
  931.  *  Given a class name as a string return the associated class type for the 
  932.  *  class, may return kQ3Failure if the string representing the class is 
  933.  *  invalid.
  934.  */
  935. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetTypeFromString(
  936.     TQ3ObjectClassNameString    objectClassString, 
  937.     TQ3ObjectType                 *objectClassType);
  938.     
  939. /*
  940.  *  Given a class type as return the associated string for the class name, 
  941.  *  may return kQ3Failure if the type representing the class is invalid.
  942.  */
  943. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetStringFromType(
  944.     TQ3ObjectType                objectClassType, 
  945.     TQ3ObjectClassNameString     objectClassString);
  946.  
  947. /* 
  948.  *  Return true if the class with this type is registered, false if not 
  949.  */
  950. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3ObjectHierarchy_IsTypeRegistered(
  951.     TQ3ObjectType                objectClassType);
  952.  
  953. /* 
  954.  *  Return true if the class with this name is registered, false if not 
  955.  */
  956. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3ObjectHierarchy_IsNameRegistered(
  957.     const char                    *objectClassName);
  958.  
  959. /*
  960.  * TQ3SubClassData is used when querying the object system for
  961.  * the subclasses of a particular parent type:
  962.  */
  963. typedef struct TQ3SubClassData {
  964.     unsigned long         numClasses;        /* the # of subclass types found */
  965.                                         /* for a parent class              */
  966.     TQ3ObjectType        *classTypes;    /* an array containing the class */
  967.                                         /* types                         */
  968. } TQ3SubClassData;
  969.  
  970. /*
  971.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  972.  *  it in with the number and class types of all of the subclasses immediately
  973.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  974.  *  errors occurred, else kQ3Failure.
  975.  *
  976.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  977.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  978.  */
  979. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetSubClassData(
  980.     TQ3ObjectType                objectClassType, 
  981.     TQ3SubClassData                *subClassData);
  982.  
  983. /*
  984.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  985.  *    by the Q3ObjectClass_GetSubClassData call.
  986.  *
  987.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  988.  *  to avoid memory leaks.
  989.  */
  990. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_EmptySubClassData(
  991.     TQ3SubClassData                *subClassData);
  992.  
  993.  
  994. /******************************************************************************
  995.  **                                                                             **
  996.  **                                Object Routines                                 **
  997.  **                                                                             **
  998.  *****************************************************************************/
  999.  
  1000. QD3D_EXPORT TQ3Status QD3D_CALL Q3Object_Dispose(
  1001.     TQ3Object             object);
  1002.     
  1003. QD3D_EXPORT TQ3Object QD3D_CALL Q3Object_Duplicate(
  1004.     TQ3Object            object);
  1005.     
  1006. QD3D_EXPORT TQ3Status QD3D_CALL Q3Object_Submit(
  1007.     TQ3Object            object,
  1008.     TQ3ViewObject        view);
  1009.     
  1010. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsDrawable(
  1011.     TQ3Object            object);
  1012.  
  1013. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsWritable(
  1014.     TQ3Object            object,
  1015.     TQ3FileObject        file);
  1016.  
  1017.  
  1018. /******************************************************************************
  1019.  **                                                                             **
  1020.  **                            Object Type Routines                             **
  1021.  **                                                                             **
  1022.  *****************************************************************************/
  1023.  
  1024. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Object_GetType(
  1025.     TQ3Object            object);
  1026.  
  1027. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Object_GetLeafType(
  1028.     TQ3Object            object);
  1029.  
  1030. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsType(
  1031.     TQ3Object            object,
  1032.     TQ3ObjectType        type);
  1033.  
  1034.  
  1035. /******************************************************************************
  1036.  **                                                                             **
  1037.  **                            Shared Object Routines                             **
  1038.  **                                                                             **
  1039.  *****************************************************************************/
  1040.  
  1041. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Shared_GetType(
  1042.     TQ3SharedObject     sharedObject);
  1043.  
  1044. QD3D_EXPORT TQ3SharedObject QD3D_CALL Q3Shared_GetReference(
  1045.     TQ3SharedObject     sharedObject);
  1046.  
  1047. /* 
  1048.  *    Q3Shared_IsReferenced
  1049.  *        Returns kQ3True if there is more than one reference to sharedObject.
  1050.  *        Returns kQ3False if there is ONE reference to sharedObject.
  1051.  *    
  1052.  *    This call is intended to allow applications and plug-in objects to delete
  1053.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1054.  *    caching objects, etc.
  1055.  *    
  1056.  *    Although many may be tempted, DO NOT DO THIS:
  1057.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1058.  *    
  1059.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1060.  *    never fun (unless you short the stock). Thanks.
  1061.  */
  1062. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Shared_IsReferenced(
  1063.     TQ3SharedObject         sharedObject);
  1064.  
  1065. /*
  1066.  *    Q3Shared_GetEditIndex
  1067.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1068.  *        object information. Returns 0 on error.
  1069.  *        
  1070.  *        Hold onto this number to determine if an object has changed since you
  1071.  *        last built your caches... To validate, do:
  1072.  *        
  1073.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1074.  *            // Cache is valid
  1075.  *        } else {
  1076.  *            // Cache is invalid
  1077.  *            RebuildSomeSortOfCache(foo);
  1078.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1079.  *        }
  1080.  */
  1081. QD3D_EXPORT unsigned long QD3D_CALL Q3Shared_GetEditIndex(
  1082.     TQ3SharedObject         sharedObject);
  1083.  
  1084. /*
  1085.  *    Q3Shared_Edited
  1086.  *        Bumps the "serial number" of sharedObject to a different value. This
  1087.  *        call is intended to be used solely from a plug-in object which is 
  1088.  *        shared. Call this whenever your private instance data changes.
  1089.  *        
  1090.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1091.  *            QuickDraw 3D isn't initialized.
  1092.  */
  1093. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shared_Edited(
  1094.     TQ3SharedObject         sharedObject);
  1095.  
  1096.  
  1097. /******************************************************************************
  1098.  **                                                                             **
  1099.  **                                Shape Routines                                 **
  1100.  **                                                                             **
  1101.  *****************************************************************************/
  1102.  
  1103. /*
  1104.  *    QuickDraw 3D 1.1 Note:
  1105.  *
  1106.  *    Shapes and Sets are now (sort of) polymorphic.
  1107.  *
  1108.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1109.  *        The following calls are identical, in implementation:
  1110.  *
  1111.  *            Q3Shape_GetElement            =    Q3Set_Get
  1112.  *            Q3Shape_AddElement            =    Q3Set_Add
  1113.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1114.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1115.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1116.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1117.  *
  1118.  *    All of these calls accept a shape or a set as their first parameter.
  1119.  *
  1120.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1121.  *    element type kQ3ElementTypeSet. See the note above about 
  1122.  *    kQ3ElementTypeSet;
  1123.  *
  1124.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1125.  *    create a set on a shape and then add the element to it. This data is
  1126.  *    attached directly to the shape. Therefore, it is possible for an element
  1127.  *    to exist on a shape without a set existing on it as well. 
  1128.  *
  1129.  *    In your application, if you attach an element to a shape like this:
  1130.  *        (this isn't checking for errors for simplicity)
  1131.  *
  1132.  *        set = Q3Set_New();
  1133.  *        Q3Set_Add(set, gMyElemType, &data);
  1134.  *        Q3Shape_SetSet(shape, set);
  1135.  *
  1136.  *    You should retrieve it in the same manner:
  1137.  *
  1138.  *        Q3Shape_GetSet(shape, &set);
  1139.  *        if (Q3Set_Contains(set, gMyElemType) == kQ3True) {
  1140.  *            Q3Set_Get(set, gMyElemType, &data);
  1141.  *        }
  1142.  *
  1143.  *    Similarly, if you attach data to a shape with the new calls:
  1144.  *
  1145.  *        Q3Shape_AddElement(shape, gMyElemType, &data);
  1146.  *
  1147.  *    You should retrieve it in the same manner:
  1148.  *
  1149.  *        if (Q3Shape_ContainsElement(set, gMyElemType) == kQ3True) {
  1150.  *            Q3Shape_GetElement(set, gMyElemType, &data);
  1151.  *        }
  1152.  *
  1153.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1154.  *    metafiles.
  1155.  *
  1156.  *    When attempting to find a particular element on a shape, you should
  1157.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1158.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1159.  *    and then Q3Shape_GetElement(set, ...).
  1160.  *
  1161.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1162.  *    used for sets of information that are shared among multiple shapes.
  1163.  *    
  1164.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1165.  *    for elements that are unique for a particular shape.
  1166.  *    
  1167.  */
  1168. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Shape_GetType(
  1169.     TQ3ShapeObject    shape);
  1170.  
  1171. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetSet(
  1172.     TQ3ShapeObject    shape,
  1173.     TQ3SetObject    *set);
  1174.  
  1175. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_SetSet(
  1176.     TQ3ShapeObject    shape,
  1177.     TQ3SetObject     set);
  1178.  
  1179. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_AddElement(
  1180.     TQ3ShapeObject    shape,
  1181.     TQ3ElementType    type,
  1182.     const void        *data);
  1183.  
  1184. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetElement(
  1185.     TQ3ShapeObject    shape,
  1186.     TQ3ElementType    type,
  1187.     void            *data);
  1188.     
  1189. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Shape_ContainsElement(
  1190.     TQ3ShapeObject    shape,
  1191.     TQ3ElementType    type);
  1192.  
  1193. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetNextElementType(
  1194.     TQ3ShapeObject    shape,
  1195.     TQ3ElementType    *type);
  1196.  
  1197. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_EmptyElements(
  1198.     TQ3ShapeObject    shape);
  1199.  
  1200. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_ClearElement(
  1201.     TQ3ShapeObject    shape,
  1202.     TQ3ElementType    type);
  1203.  
  1204.  
  1205. /******************************************************************************
  1206.  **                                                                             **
  1207.  **                            Color Table Routines                             **
  1208.  **                                                                             **
  1209.  *****************************************************************************/
  1210.  
  1211.  
  1212. QD3D_EXPORT TQ3Status QD3D_CALL Q3Bitmap_Empty(
  1213.     TQ3Bitmap                    *bitmap);
  1214.  
  1215. QD3D_EXPORT unsigned long QD3D_CALL Q3Bitmap_GetImageSize(
  1216.     unsigned long                width,
  1217.     unsigned long                height);
  1218.  
  1219. #ifdef __cplusplus
  1220. }
  1221. #endif  /*  __cplusplus  */
  1222.  
  1223. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  1224.  
  1225. #if defined(__xlc__) || defined(__XLC121__)
  1226.     #pragma options enum=reset
  1227.     #pragma options align=reset
  1228. #elif defined(__MWERKS__)
  1229.     #pragma enumsalwaysint reset
  1230.     #pragma options align=reset
  1231. #elif defined(__MRC__) || defined(__SC__)
  1232.     #if PRAGMA_ENUM_RESET_QD3D
  1233.         #pragma options(pack_enums)
  1234.         #undef PRAGMA_ENUM_RESET_QD3D
  1235.     #endif
  1236.     #pragma options align=reset
  1237. #endif
  1238.  
  1239. #endif  /* OS_MACINTOSH */
  1240.  
  1241. #endif /*  QD3D_h  */
  1242.  
  1243.